﻿@************************************************************************************//
// Autor:  			                							     				*//
//***********************************************************************************//
// RetiroResguardo()	Acceso solo ADMINISTRADOR									*//
// Vista que devuelve todos los ítems de BI resguardables listados,  paginados		*//
//  y con opción de búsqueda.		 												*//
// _________________________________________________________________________________*@

@model PagedList.IPagedList<SIBI.Models.BienInformatico>
@using SIBI.Helpers
@{
    ViewBag.Title = "RetiroResguardo";
}

<h2>Retiro Por Resguardo</h2>

@*<script src="@Url.Content("~/Scripts/myScript2.js")" type="text/javascript"></script>*@
<script src="@Url.Content("~/Scripts/jquery.ui.autocomplete.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/myScript7.js")" type="text/javascript"></script>

@ViewBag.msnCorreo
    @using (Html.BeginForm()){  
            @Html.Hidden("tipoRes", ViewBag.tipoRes as string) 
            <table width="100%">
                    <tr>
                        <td>
                            Usuario: <br /> @Html.TextBox("SearchRes", ViewBag.CurrentRes as string) &nbsp;
                        </td>
                        <td>   
                            Serial:<br /> @Html.TextBox("SearchSerial", ViewBag.CurrentSerial as string) &nbsp;
                        </td>
                        <td>
                            <div id="DialogRetiroResguardoTipoBien" title="Tipo de Bienes"></div><br />
                            Tipo Bien:<br /> @Html.TextBox("SearchTipo", ViewBag.CurrentTipo as string)<br /> &nbsp;
                        </td> 
                    </tr>
                    <tr>
                        <td>
                            <div id="DialogRetiroResguardoEstado" title="Estados"></div><br />
                            Estado:<br /> @Html.TextBox("SearchEst", ViewBag.CurrentEst as string)<br /> &nbsp;
                        </td>
                        <td>
                            N° Anexo/Factura: <br />  @Html.TextBox("SearchAct", ViewBag.CurrentAct as string) &nbsp;
                        </td>
                        <td>
                            Clase Objeto: <br />  @Html.TextBox("SearchClaseObjeto", ViewBag.CurrentUbi as string) &nbsp;
                        </td>
                    </tr>
            </table>
         <input type="submit" value="Filtrar" />
    }
<table  width="100%">
    <tr>
        <th>
            
        </th>
        <th>
            Usuario
        </th>
        <th>
            Número Serial
        </th>
        <th>
            Estado
        </th>
        <th>
            Tipo Bien
        </th>
        <th>
            Cargo
        </th>
        <th>
            Centro Costo 
        </th>
        <th>
            Clase Objeto 
        </th>
        <th></th>
    </tr>
    @{
        var i = 1;
    }
@foreach (var item in Model)
{
    <tr>
        @{
            if (item.ncar != null)
            { 
                <td align="center">
                    <img src="../../Content/images/user.png" alt="user" />
                </td>
                <td>
                    @Html.UppercaseFirst(@Html.DisplayFor(modelItem => item.ncar.empleados).ToString())
                </td>
            }
            else
            {
                <td align="center">
                    <img src="../../Content/images/home.png" alt="home" />
                </td>
                <td>
                    @Html.UppercaseFirst((String)@ViewBag.Localidades[i-1])
                </td>
            }
        }
        @{i = i + 1;}
        <td>
            @Html.DisplayFor(modelItem => item.BienInformaticoId)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.nest.cnom)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.ntib.cnom)
        </td>
        <td>
            @Html.UppercaseFirst(@Html.DisplayFor(modelItem => item.ncar.cdes).ToString())
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.ceco_id)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.nmym.ncob.cnom)
        </td>
        <td>
            @Html.ActionLink("Resguardar", "ResguardoR", new { id = item.BienInformaticoId, tipoRes = ViewBag.tipoRes })
        </td>
    </tr>
}



</table>
<br />

<div>
    Pag @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber)
    de @Model.PageCount
    &nbsp;
    @if (Model.HasPreviousPage)
    {
        @Html.ActionLink("<<= ", "RetiroResguardo", new { page = 1, currentSerial = ViewBag.CurrentSerial, currentEst = ViewBag.CurrentEst, currentTipo = ViewBag.CurrentTipo, currentUbi = ViewBag.CurrentUbi, tipoRes = ViewBag.tipoRes, currentRes = ViewBag.CurrentRes, currentAct = ViewBag.CurrentAct })
        @Html.Raw("&nbsp;");
        @Html.ActionLink("<=", "RetiroResguardo", new { page = Model.PageNumber - 1, currentSerial = ViewBag.CurrentSerial, currentEst = ViewBag.CurrentEst, currentTipo = ViewBag.CurrentTipo, currentUbi = ViewBag.CurrentUbi, tipoRes = ViewBag.tipoRes, currentRes = ViewBag.CurrentRes, currentAct = ViewBag.CurrentAct })
    }
    else
    {
        @:<<=
        @Html.Raw("&nbsp;");
        @:<=
    }
    &nbsp;
    @if (Model.HasNextPage)
    {
        @Html.ActionLink("=>", "RetiroResguardo", new { page = Model.PageNumber + 1, currentSerial = ViewBag.CurrentSerial, currentEst = ViewBag.CurrentEst, currentTipo = ViewBag.CurrentTipo, currentUbi = ViewBag.CurrentUbi, tipoRes = ViewBag.tipoRes, currentRes = ViewBag.CurrentRes, currentAct = ViewBag.CurrentAct })
        @Html.Raw("&nbsp;");
        @Html.ActionLink(" =>>", "RetiroResguardo", new { page = Model.PageCount, currentSerial = ViewBag.CurrentSerial, currentEst = ViewBag.CurrentEst, currentTipo = ViewBag.CurrentTipo, currentUbi = ViewBag.CurrentUbi, tipoRes = ViewBag.tipoRes, currentRes = ViewBag.CurrentRes, currentAct = ViewBag.CurrentAct })
    }
    else
    {
        @:=>
        @Html.Raw("&nbsp;")
        @:=>>
    }
</div>